Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8690621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:56:25+00:00 2026-06-12T23:56:25+00:00

<html> <head> <script> function replacesrc() { var array= new Array(); array[1,2,3,4]=document.getElementById(From).value.split( ); document.getElementById(map).src=https://maps.google.com/maps?f=d&amp;source=s_d&amp;saddr=+array[1]+++array[2]+++array[3]+,+North+Augusta,+SC&amp;daddr=Hilton+Head+Island,+SC&amp;geocode=FYn4_wEd4BQd-ym_ve9aOTP4iDGvGGPbsAEwOw%3BFfyU6wEdINAv-ymtGdOO3Hn8iDE9KKLreqblLA&amp;aq=1&amp;oq=hi&amp;sll=33.623768,-80.925293&amp;sspn=5.551464,10.129395&amp;hl=en&amp;mra=ls&amp;ie=UTF8&amp;t=m&amp;ll=32.88718,-81.37587&amp;spn=1.3416,1.24656&amp;output=embed document.getElementById(test).value=array[1,2,3,4];

  • 0
<html>
<head>
<script>
function replacesrc() {
    var array= new Array();
    array[1,2,3,4]=document.getElementById("From").value.split(" ");
    document.getElementById("map").src="https://maps.google.com/maps?f=d&amp;source=s_d&amp;saddr="+array[1]+"+"+array[2]+"+"+array[3]+",+North+Augusta,+SC&amp;daddr=Hilton+Head+Island,+SC&amp;geocode=FYn4_wEd4BQd-ym_ve9aOTP4iDGvGGPbsAEwOw%3BFfyU6wEdINAv-ymtGdOO3Hn8iDE9KKLreqblLA&amp;aq=1&amp;oq=hi&amp;sll=33.623768,-80.925293&amp;sspn=5.551464,10.129395&amp;hl=en&amp;mra=ls&amp;ie=UTF8&amp;t=m&amp;ll=32.88718,-81.37587&amp;spn=1.3416,1.24656&amp;output=embed"
    document.getElementById("test").value=array[1,2,3,4];
}


</script>
</head>
<body>

<iframe id="map" width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?f=d&amp;source=s_d&amp;saddr=2000+Knobcone+Ave,+North+Augusta,+SC&amp;daddr=Hilton+Head+Island,+SC&amp;geocode=FYn4_wEd4BQd-ym_ve9aOTP4iDGvGGPbsAEwOw%3BFfyU6wEdINAv-ymtGdOO3Hn8iDE9KKLreqblLA&amp;aq=1&amp;oq=hi&amp;sll=33.623768,-80.925293&amp;sspn=5.551464,10.129395&amp;hl=en&amp;mra=ls&amp;ie=UTF8&amp;t=m&amp;ll=32.88718,-81.37587&amp;spn=1.3416,1.24656&amp;output=embed"></iframe>
<br />From: <input id="From" type="text" /> <button onClick="replacesrc()">Directions</button><input id="test" type="text" value="test" />

<br /><small><a href="https://maps.google.com/maps?f=d&amp;source=embed&amp;saddr=2000+Knobcone+Ave,+North+Augusta,+SC&amp;daddr=Hilton+Head+Island,+SC&amp;geocode=FYn4_wEd4BQd-ym_ve9aOTP4iDGvGGPbsAEwOw%3BFfyU6wEdINAv-ymtGdOO3Hn8iDE9KKLreqblLA&amp;aq=1&amp;oq=hi&amp;sll=33.623768,-80.925293&amp;sspn=5.551464,10.129395&amp;hl=en&amp;mra=ls&amp;ie=UTF8&amp;t=m&amp;ll=32.88718,-81.37587&amp;spn=1.3416,1.24656" style="color:#0000FF;text-align:left">View Larger Map</a></small>

</body>
</html>

That is my code. It keeps passing it as undefined. Could someone help me out here? I’ve tried difference ways to fix this. But I still can not. From my point I did it right, cause I put a test function to see what it is sending and I get the same exact thing back, but when it put it in the src it put it as undefined.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T23:56:26+00:00Added an answer on June 12, 2026 at 11:56 pm

    Try this in place of the first two lines. Then access the elements starting at 0, so array[0] is the first item, array[1] is the second, etc.

    var array = document.getElementById("From").value.split(" ");
    

    And for the last line use this:

    document.getElementById("test").value = array.join();
    

    Why?

    array[1,2,3,4] doesn’t do what you expect. It’s rather unintuitive. The commas here do not let you access multiple array indices.

    1,2,3,4 is an expression using the oddball comma , operator three times. For an expression a,b expression a is evaluated and then thrown away. Next b is evaluated and that becomes the value of the comma operator.

    1,2,3,4 == ((1,2),3),4
            == (2,3),4
            == 3,4
            == 4
    

    So writing array[1,2,3,4] is in fact identical with array[4].

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

html head: <script type=text/javascript language=JavaScript> function getStyle() { var temp = document.getElementById(cont).style.display; return temp;
#!/usr/bin/perl print Content-type: text/html \n\n; print qq(<html> <head> <script type=text/javascript src=/jquery.js></script> <script> jQuery(document).ready(function(){ jQuery(#form_lang).submit(function(e){
<!DOCTYPE HTML> <html> <head> <script type=text/javascript src=http://code.jquery.com/jquery-1.7.2.js></script> <script type=text/javascript> $(#myBtn).on(click,function(){ alert('myBtn Clicked'); }); </script>
<html> <head> <title>Question</title> <script type="text/javascript" > function MouseOverHand(ID) { var Cursor='hand'; var ID=ID; if
<HTML> <HEAD> <title>Login</title> <script type=text/javascript src=http://script.auction.co.kr/common/jquery.js></script> <script type=text/javascript> $(document).ready(function() { $(:input[name='txtPassword']).blur(function(e){ $(this).css(background-color,white); }); $(:input[name='txtPassword']).focus(function(e){
Sample code: <!DOCTYPE html> <html> <head> <title>test</title> <script language=javascript type=text/javascript> function init() { var
Take a look at this html: <head> <title>Test page</title> <script type=text/javascript> function submitForm() {
Heres my simple html source <html> <head> <title> Dec2Bin </title> <script type=text/javascript> function app()
<html> <head> <script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js type=text/javascript></script> <script type=text/jscript> $('document').ready(function (){ var clickNo=0; $('div#pics>img').hide() $('div#pics>input').click(function(event){ $('div#pics>img')[0].show('slow');
I have these lines in my html head section <script type=text/javascript src=../behaviour/location.js></script> <script type=text/javascript

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.