473,408 Members | 1,729 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Questions about Dynamicurl

Hello. I admit that I don't know much about javascript. I'm pretty much relegated to only using html in webdesign. But I'm trying to do something and I think I may be close with dynamicurl in JS.

I found the following online tonight.

---------------
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script>
  4. function dynamicurl()
  5. {
  6.     location.href = document.form1.test.value;
  7. }
  8. </script> 
  9. </head>
  10. <body>
  11. <form name="form1">
  12. <input type="text" name="test">
  13. <a href="#" onClick="dynamicurl();">Click Here</a>
  14. </form>
  15. </body>
  16. </html>
-------------------------------

When I put this into an html page, it pops up a small text box where the user can type in anything they want and click the "click here" button. When they do, they are linked from their current location to a folder named just what they typed.

For instance, if they type the word "javascript" into the text box and click the button, they are taken to

http://www.domain.com/javascript

Man, this is sooo close to what I need. I need something that does the same thing, but I'm wondering if there's any way to append something to the beginning and end of the text that was typed in. I want to take them to a particular picture instead of a folder. Using the text "javascript" as an example, I would want the dynamically generated url to be:

http://www.domain.com/bottom-javascript.jpg

So I'm basically adding "bottom-" (with the hyphen) BEFORE the text that was typed in, and then adding the ".jpg" at the end.

Is this something that could be done?

I'm guessing that this line:
location.href = document.form1.test.value;

Is the line that builds the link, but I'm afraid my knowledge of js is, well, I don't have any really......

If anyone in here knows the answer though, I'd be eternally grateful if you could shed some light.

Thanks
Beau
Feb 9 '07 #1
2 952
I figured it out. Wasn't used to having to use + signs between things that I wanted to show up. This works like a charm! Out of curiosity, would a script like the one below pull lots of system resources?



Hello. I admit that I don't know much about javascript. I'm pretty much relegated to only using html in webdesign. But I'm trying to do something and I think I may be close with dynamicurl in JS.

I found the following online tonight.

---------------
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script>
  4. function dynamicurl()
  5. {
  6.     location.href = document.form1.test.value;
  7. }
  8. </script> 
  9. </head>
  10. <body>
  11. <form name="form1">
  12. <input type="text" name="test">
  13. <a href="#" onClick="dynamicurl();">Click Here</a>
  14. </form>
  15. </body>
  16. </html>
-------------------------------

When I put this into an html page, it pops up a small text box where the user can type in anything they want and click the "click here" button. When they do, they are linked from their current location to a folder named just what they typed.

For instance, if they type the word "javascript" into the text box and click the button, they are taken to

http://www.domain.com/javascript

Man, this is sooo close to what I need. I need something that does the same thing, but I'm wondering if there's any way to append something to the beginning and end of the text that was typed in. I want to take them to a particular picture instead of a folder. Using the text "javascript" as an example, I would want the dynamically generated url to be:

http://www.domain.com/bottom-javascript.jpg

So I'm basically adding "bottom-" (with the hyphen) BEFORE the text that was typed in, and then adding the ".jpg" at the end.

Is this something that could be done?

I'm guessing that this line:
location.href = document.form1.test.value;

Is the line that builds the link, but I'm afraid my knowledge of js is, well, I don't have any really......

If anyone in here knows the answer though, I'd be eternally grateful if you could shed some light.

Thanks
Beau
Feb 9 '07 #2
acoder
16,027 Expert Mod 8TB
I figured it out. Wasn't used to having to use + signs between things that I wanted to show up. This works like a charm! Out of curiosity, would a script like the one below pull lots of system resources?
Glad you got it working by yourself! Another way to access objects is to use the id:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("test").value
This is the some as
Expand|Select|Wrap|Line Numbers
  1. document.form1.test.value
as long as you set the id for the test input box to "test".

What do you mean by pulling lots of system resources? Do you mean accessing files?
Feb 9 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: softwareengineer2006 | last post by:
All Interview Questions And Answers 10000 Interview Questions And Answers(C,C++,JAVA,DOTNET,Oracle,SAP) I have listed over 10000 interview questions asked in interview/placement test papers for...
0
by: connectrajesh | last post by:
INTERVIEWINFO.NET http://www.interviewinfo.net FREE WEB SITE AND SERVICE FOR JOB SEEKERS /FRESH GRADUATES NO ADVERTISEMENT
2
by: freepdfforjobs | last post by:
Full eBook with 4000 C#, JAVA,.NET and SQL Server Interview questions http://www.questpond.com/SampleInterviewQuestionBook.zip Download the JAVA , .NET and SQL Server interview sheet and rate...
4
by: Drew | last post by:
I posted this to the asp.db group, but it doesn't look like there is much activity on there, also I noticed that there are a bunch of posts on here pertaining to database and asp. Sorry for...
8
by: Krypto | last post by:
Hi, I have used Python for a couple of projects last year and I found it extremely useful. I could write two middle size projects in 2-3 months (part time). Right now I am a bit rusty and trying...
0
by: ramu | last post by:
C# Interview Questions and Answers8 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers8.html C# Interview Questions and Answers7...
1
by: ramu | last post by:
C# Interview Questions and Answers8 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers8.html C# Interview Questions and Answers7...
0
by: ramu | last post by:
C# Interview Questions and Answers8 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers8.html C# Interview Questions and Answers7...
0
by: reema | last post by:
EJB Interview Questions http://interviewdoor.com/technical/EJB-Interview-Questions.htm CSS Interview Questions http://interviewdoor.com/technical/CSS-Interview-Questions.htm C Interview Questions...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.