Results 1 to 7 of 7

Thread: How to replace HTML code using javascript

  1. #1
    Join Date
    Apr 2010
    Posts
    90

    How to replace HTML code using javascript

    Hello anyone knows any way to replace HTML tag using javascript and the other try using innerHTML but I really want is to replace the label does not put html in it. So I thought that there would be some genius who can solve this issue.!! So please help me as soon as possible.!!

  2. #2
    Join Date
    Mar 2008
    Posts
    227

    Re: How to replace HTML code using javascript

    Hello,
    If that label does not have content, you can easily do both with innerHTML, as replaceNode, and the particular label you want to replace you detect from the parentNode. (Since this is very basic, no need of saying me Genius).

  3. #3
    Join Date
    Mar 2008
    Posts
    258

    Re: How to replace HTML code using javascript

    You can Get and change the URL of a form in the following manner :
    Code:
     <html>
        <head>
        <script type="text/javascript">
        function getAction ()
        (
                var x = document.forms.myForm;
                alert (x.action)
        )
       
        changeAction function (action)
        (
                var x = document.forms.myForm;
                x.action = action;
                alert (x.action)
        )
        </ Script>
        </ Head>
       
        <body>
        name="myForm" <form action="ejemplos.php">
        <input type="button" onclick="getAction()" value="Ver action"> attribute value
        <br>
        <input type="button" onclick="changeAction('hola.php')" value="Cambiar action"> attribute value
        </ Form>
        </ Body>
        </ Html>

  4. #4
    Join Date
    Oct 2008
    Posts
    167

    Re: How to replace HTML code using javascript

    I am providing you the following code which would be useful for refreshing the page content :
    HTML Code:
     <html>
        <head>
        <script type="text/javascript">
        function refresh ()
        (
                window.location.reload ();
        )
        </ Script>
        </ Head>
       
        <body>
        <form>
        <input type="button" value="Refresher page" onclick="refresh()">
        </ Form>
        </ Body>
        </ Html>

  5. #5
    Join Date
    Dec 2008
    Posts
    202

    Re: How to replace HTML code using javascript

    You can call a function from HTML Script, from the following code :
    Code:
     <script Language="JavaScript"> 
      <! - 
      cargarPagina function (parameter) ( 
          parent.otroFrame.location = "otra" + parameter + ". htm" 
      ) 
      //--> 
      </ Script>
    This function takes one parameter and that value is added to the name of a page, which will then be displayed in the frame otroFrame.

  6. #6
    Join Date
    May 2008
    Posts
    2,389

    Re: How to replace HTML code using javascript

    I am getting an access problem if I click more than once. This poses a problem for me in my first DIV will be my menu, then the second DIV will be my chosen different pages or links. My Menu launch HTML pages into the IFRAME, but it seems that I can not open two IFRAME on one another. Hence the problem of the button, but I am not able to do the program. Is there any trick for doing this..???

  7. #7
    Join Date
    Nov 2005
    Posts
    1,323

    Re: How to replace HTML code using javascript

    Maybe the following trick will help you :
    HTML Code:
    <html>
    	  <head>
    		  <script language="JavaScript" type="text/javascript">
    			 loadPage function (url) (
    				 document.getElementById ('if'). contentWindow.document.location.href = url;
    			 )
    		  </ Script>
    	  </ Head>
    	  <body>
    		  <div id="f_1">
    			 Click to load <button onclick="javascript:loadPage('http://www.google.be');"> Div below </ button>
    		  </ Div>
                                      <div id="clear" width="640" height="480"> </ div>
    		  <div id="f_2">
    			 <iframe id="if" width="640" height="480">
    			 </ Iframe>
    		  </ Div>
    		  </ Div>
    		  </ Div>
    	  </ Body>
      </ Html>

Similar Threads

  1. JavaScript - location.replace
    By Cordaro in forum Software Development
    Replies: 6
    Last Post: 13-05-2010, 11:55 PM
  2. Javascript - replace HTML tags with spaces
    By Jensen Ackles in forum Software Development
    Replies: 6
    Last Post: 13-05-2010, 12:10 PM
  3. How to convert Javascript code to Html code
    By Bosch in forum Software Development
    Replies: 3
    Last Post: 21-09-2009, 01:20 PM
  4. Do google understand javascript code in my HTML website?
    By Sid-O in forum Software Development
    Replies: 3
    Last Post: 22-07-2009, 07:45 PM
  5. JavaScript code outside html page
    By Gefry in forum Software Development
    Replies: 3
    Last Post: 30-04-2009, 03:53 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,292,223.70257 seconds with 17 queries