34 users online (1 members and 33 guests)  


  Results 1 to 15 of 15

Related

  1. textbox overlay suggestion    Forum: Javascript Forum
    Replies: 1
  2. Positioning Textbox??    Forum: HTML Forum
    Replies: 3
  3. textbox to url    Forum: Javascript Forum
    Replies: 0
  4. javascript onclick event to refresh iframe.    Forum: Javascript Forum
    Replies: 5
  5. how to set color for textbox    Forum: HTML Forum
    Replies: 2
  1. #1
    orlandojobz's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2008
    Posts
    7

    Question Javascript Navigate iframe using a textbox


    Hello,
    I have a textbox called userinput, I use by default
    a link in the userinput.
    e.g
    Code:
    </p><input type='text' id='userinput' value='http://www.yahoo.com/' />
     I need to change  iframe1 
    to the url thats in the textbox ID=userinput
    button-->
    <button onclick="genuserURL();">change the iframe to new url</button> <!  !user input !
    I saw a link last month on a google search, but I can not find it if someone knows how to accomplish this can you post it here...
    Thanks....

  2. #2
    rangana's Avatar
    Moderator/Allstar

    Status
    Offline
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    317

    Re: Javascript Navigate iframe using a textbox

    Hi orlandojobz,

    First of all, welcome on board

    Secondly, you might find this ammendment useful:
    HTML Code:
    <script type="text/javascript">
    var ray={
    changeIframe:function(inp,iframeEl)
    	{
    		this.returnID(iframeEl).setAttribute('src',this.returnID(inp).value);
    	},
    returnID:function(el)
    	{
    		return document.getElementById(el);
    	}
    }
    </script>
    </p><input type='text' id='userinput' value='http://www.yahoo.com/' />
    <button onclick="ray.changeIframe('userinput','myframe');">change the iframe to new url</button>
    <iframe src="about:blank" id="myframe"></iframe>
    Checkout my porfolio.
    Please click the button when a member helped you.
    Take time to use Forum's Search function.

  3. #3
    orlandojobz's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2008
    Posts
    7

    Question Re: Javascript Navigate iframe using a textbox

    Quote Originally Posted by rangana View Post
    Hi orlandojobz,

    First of all, welcome on board

    Secondly, you might find this ammendment useful:
    HTML Code:
    <script type="text/javascript">
    var ray={
    changeIframe:function(inp,iframeEl)
    	{
    		this.returnID(iframeEl).setAttribute('src',this.returnID(inp).value);
    	},
    returnID:function(el)
    	{
    		return document.getElementById(el);
    	}
    }
    </script>
    </p><input type='text' id='userinput' value='http://www.yahoo.com/' />
    <button onclick="ray.changeIframe('userinput','myframe');">change the iframe to new url</button>
    <iframe src="about:blank" id="myframe"></iframe>
    Hello rangana Glad to be here
    Umm I just tested the Code when I clicked the button the iframe
    here is part of the error that was generated!...
    Internet Explorer cannot display the webpage

    Most likely causes:
    You are not connected (I am connected! to the net)
    the link that in textbox is yahoo com

  4. #4
    rangana's Avatar
    Moderator/Allstar

    Status
    Offline
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    317

    Re: Javascript Navigate iframe using a textbox

    Try to provide a valid link: http://www.yahoo.com
    Checkout my porfolio.
    Please click the button when a member helped you.
    Take time to use Forum's Search function.

  5. #5
    orlandojobz's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2008
    Posts
    7

    Question Re: Javascript Navigate iframe using a textbox

    Hello I did valid http : // yahoo com /, >no spaces>
    sorry I can't post the full link I need 5 posts...

  6. #6
    rangana's Avatar
    Moderator/Allstar

    Status
    Offline
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    317

    Re: Javascript Navigate iframe using a textbox

    I have IE7 for test, but it changes the iframe's URL. Could you by chance show us your code...and the value you keyed in.
    Checkout my porfolio.
    Please click the button when a member helped you.
    Take time to use Forum's Search function.

  7. #7
    orlandojobz's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2008
    Posts
    7

    Question Re: Javascript Navigate iframe using a textbox

    Thanks rangana,
    I have IE7 as well...

    here the code
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
    <html>
    
    <head>
    <meta name="KEYWORDS" content="Flooring, Tile, Counter Top, Wood, Hardwood, Laminate, Carpet, Stone, Glass Tile, 
    
    flooring494949">
    <meta name="DESCRIPTION" content="Solutions LLC..">
    <title>Flooring, Solutions LLC .</title>
    <meta http-equiv="CONTENT-LANGUAGE" content="EN">
    <meta name="revisit-after" content="14 days">
    <meta name="Generator" content="http://websitesubmit.hypermart.net/">
    <meta name="robots" content="all">
    <meta name="Author" content="Flooring, Solutions LLC">
    <!-- MetaTags http://websitesubmit.hypermart.net/ -->
    <!-- Flooring, Solutions -->
    
    </head>
    
    <script type="text/javascript">
    var ray={
    changeIframe:function(inp,iframeEl)
    	{
    		this.returnID(iframeEl).setAttribute('src',this.returnID(inp).value);
    	},
    returnID:function(el)
    	{
    		return document.getElementById(el);
    	}
    }
    </script>
    </p><input type='text' id='userinput' value='http://www.yahoo.com/' />
    <button onclick="ray.changeIframe('userinput','myframe');">change the iframe to new url</button>
    <iframe src="about:blank" id="myframe"></iframe>
    
    </body>
    </html>

    ??


  8. #8
    rangana's Avatar
    Moderator/Allstar

    Status
    Offline
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    317

    Re: Javascript Navigate iframe using a textbox

    That works fine for me, both on IE and FF.
    Checkout my porfolio.
    Please click the button when a member helped you.
    Take time to use Forum's Search function.

  9. #9
    orlandojobz's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2008
    Posts
    7

    Re: Javascript Navigate iframe using a textbox

    oops it works I did not save my changes
    rangana Thank You for your help.


  10. #10
    rangana's Avatar
    Moderator/Allstar

    Status
    Offline
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    317

    Re: Javascript Navigate iframe using a textbox

    There you go, sometimes, you just have to relax

    No problem, glad I could help
    Checkout my porfolio.
    Please click the button when a member helped you.
    Take time to use Forum's Search function.

  11. #11
    orlandojobz's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2008
    Posts
    7

    Re: Javascript Navigate iframe using a textbox

    I am having trouble displaying <HTML> code in a textarea textbox, I can't seem to formating the writing in my Javscript Function for my textbox,
    Textbox ID is: opptext2.value
    Code:
    opptext2.value=opptext2.value+"<p id=""content3">"
    what I tried
    Code:
    opptext2.value+"<p id=""content3">"
    opptext2.value+"<p id="'content3'">"
    How can I display in opptext2.value Textbox

    how can I learn to write any html source code
    to display in a textbox
    to give you an idea I know this wont work but could you write it so that it can work maybe I can figure out how to write a whole

    <html> <Head> <body onload="Load();"> so It display corectly in a textbox

    Here's another one I had trouble displaying

    opptext2.value=opptext2.value"<input type='text' id='userinput' value="http://www.yahoo.com/'"/>"

    and this one too.
    Code:
    opptext2.value=opptext2.value"<" ID="txt1">"



    if you need more of my code I am ready lemme know...

  12. #12
    orlandojobz's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2008
    Posts
    7

    Wink Re: Javascript Navigate iframe using a textbox

    Playing around I got this worked!

    the Real look behind the scenes to make it work in a textbox(Javascript)
    opptext2.value= "\"<li><a href=\"http://www.bestsites.fws1.com\"\ target=\"_blank\">\" ";


    the output what you see in this textbox(Javascript) a complete working Link ready to be copied to the Html Body...
    current testing other source code.. I remember having my friend do this for me in visual basic6 it was confussing at that.
    I wish i would of wanted to learn :S
    opptext2.value=
    "<li><a href="http://www.bestsites.fws1.com" target="_blank">"

    I took the idea from
    "They call it an \"escape\" character"
    so when ever I want a special character use the escape \ character, thats what I know lol

    e.g
    I need to put a " I do \"

    opptext2.value= "\"
    opptext2.value= "<li><a href=\

    now i need " after the = I do this \"
    opptext2.value= "<li><a href=" <--- now it looks like this -->


    Someday I will be real good at this, so I write and test
    all the way through testing if I get an error.
    I had errors when I first wrote a Complete link in the textbox using javascript but I was able to backup and fix it... interesting I wonder how the write of my page will turn out.

    Thanks
    Last edited by orlandojobz; 11-02-2008 at 03:45 AM.

  13. #13
    CrazyHairy's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2009
    Posts
    2

    Re: Javascript Navigate iframe using a textbox

    Sorry for bumping a REALLY old thread, but this topic is really close to my problem. I'm really new to JS with a good amount of experience in php and MySQL and I'm building a database with a live search feature that narrows down records as I type.

    I want an input text box where I can type in a string that changes the url of my iframe as I'm typing and send a query string via the url. My problem seems pretty darn stupid, but I've been working on it for several hours now, I have this code:

    JS code
    Code:
    var surch={
    changeIframe:function(inp,iframeEl)
     	{
     		this.returnID(iframeEl).setAttribute('src',this.returnID(inp).value);
     	},
    returnID:function(el)
     	{
     		return document.getElementById(el);
    	}
    }
    ...borrowed from this thread

    And this HTML...
    Code:
    <input id='userinput' name='search' type='text' onkeyup=\"surch.changeIframe('userinput','myframe');\" value='(search here)' onclick=\"if(this.value == '(search here)') {this.value = ''; }\" AUTOCOMPLETE = 'off' />
    
    <iframe id=\"myframe\" name=\"ifrm\" src=\"about:blank\" scrolling=\"auto\" width=\"100%\" height=\"500\" frameborder=\"1\" align=\"left\">
    	[Your browser doesn't support iframes.]
    </iframe>
    My problem is that I want to append "http://www.example.php?test=[query string goes here]. I can communicate the query string from the textbox to the iframe, but I just can't get the address slapped on the front (without typing the whole thing out, which is an unacceptable solution).

    But I just can't seem to figure it out. Anytime I try to add a string to the front of any of my variables the js stops working... sheesh, and I thought php had crappy error messages!

    Please help me, I would strangle my computer... if I could only find it's neck!

  14. #14
    jthayne's Avatar

    Status
    Offline
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    508

    Re: Javascript Navigate iframe using a textbox

    How are you trying to prepend the URL? PHP or JavaScript? Please post some sample code of what you are trying to do and that isn't working.

  15. #15
    CrazyHairy's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2009
    Posts
    2

    Re: Javascript Navigate iframe using a textbox

    Quote Originally Posted by jthayne View Post
    How are you trying to prepend the URL? PHP or JavaScript? Please post some sample code of what you are trying to do and that isn't working.
    I tried:
    Code:
    changeIframe:function('www.test.com'+inp,iframeEl)
    and...
    Code:
    <input id='userinput' name='search' type='text' onkeyup=\"surch.changeIframe('www.test.com'+'userinput','myframe');\" value='(search here)' onclick=\"if(this.value == '(search here)') {this.value = ''; }\" AUTOCOMPLETE = 'off' />
    and...
    Code:
    return document.getElementById('www.test.com'+el);
    I'm probably doing something crazy wrong, but I really am out of my element with js.



Tags for this Thread