Computing.Net > Forums > Web Development > pulling code?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

pulling code?

Reply to Message Icon

Name: ssjheero_yuy99
Date: February 24, 2006 at 12:53:07 Pacific
OS: Win xp
CPU/Ram: 3400+ 1GBddr
Product: custom
Comment:

Hello,

I have a question about how to get an html page to pull code.

Basically I have a section of my html code, The navigational links, that I am using on all the pages on the site. And because of this, if I want to change one thing, I have to change all of the pages. This can be fun...

I was hoping that I could use a JavaScript call to pull the code in for me. I know that I can make a menu.js file and have the html code pull it in for me, however, I can only get it to write a line, and not create a link. document.write('');, I am guessing that there is a way, but I just don't know how.

If you know how to do this, it would be very useful!

George

Please respond after you have solved your problem to notify who helped you and what solved the problem. Both sides benefit when you do.



Sponsored Link
Ads by Google

Response Number 1
Name: Michael J (by mjdamato)
Date: February 24, 2006 at 16:01:28 Pacific
Reply:

Just create a document.write for each line of HTML code. It can be just text, links, images, whatever.

For example, this (spaces added to prevent the code from being parsed by the forum):


< a href="home.htm" >Home Page< /a >
< a href="about.htm" >About Us< /a >
< a href="home.htm" >Home Page< /a >

Becomes this:


document.write('< a href="home.htm" >Home Page< /a >');
document.write('< a href="about.htm" >About Us< /a >');
document.write('< a href="home.htm" >Home Page< /a >');

The key is to use double quotes in the html code and then use single quotes around the html in the document.writes.


Michael J


0

Response Number 2
Name: Tautitan
Date: February 25, 2006 at 06:29:56 Pacific
Reply:

Or you could have a totally separate page with the whole navigation in and use a PHP include command (if your webserver supports it that is)

Matt

matt@webgrafix.co.uk

0

Response Number 3
Name: ssjheero_yuy99
Date: February 26, 2006 at 11:28:19 Pacific
Reply:

Thank you for your help.

The college that i'm hosting the site with has classes in PHP, So i believe they would support it. However, since I don't know PHP yet, its one of the languages I will learn in the years to come, Java Script will work. I might try messing around with PHP and see if it looks like it works better.

Thanks for all your help, the responces were very useful.

Thanks again!

George

Please respond after you have solved your problem to notify who helped you and what solved the problem. Both sides benefit when you do.


0

Response Number 4
Name: Michael J (by mjdamato)
Date: February 26, 2006 at 19:07:30 Pacific
Reply:

If you already know JavaScript, then PHP will be a breeze to learn as it is almost identical.

Michael J


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


GlassFish vs Tomcat php/mysql database



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: pulling code?

mysql, pull/display random entry
    Summary: I have a MySQL database with simply one table .... 4 columns, id_number, quote, name, notes I would like, in the header of my website, for a random quote to be pulled from the database upon each arriv...
www.computing.net/answers/webdevel/mysql-pulldisplay-random-entry/3066.html

Pulling info from ftp site to myne
    Summary: Hi, im trying to pull info from this .txt file "ftp://733081@8.2.120.236/cod/8.2.120.236:28960/main/awe_cod/ban.txt" to my website www.xtpgaming.info so i can post the ban list on the site and people...
www.computing.net/answers/webdevel/pulling-info-from-ftp-site-to-myne/3844.html

simple php codes
    Summary: is there a php code that reads a file until it finds a certain word or line of text or something of the sort and is possible to highlight the text for deletion or for storing as a variable or somethin...
www.computing.net/answers/webdevel/simple-php-codes/449.html