Go Back   Novahq.net Forum > Computers > Web design and Programming
FAQ Community Calendar Today's Posts Search

Web design and Programming Discuss website creation and other programming topics.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-04-2007, 04:45 AM
Chrispy is offline Chrispy

Join Date: Sep 2005
Location: Peria, New Zealand
Posts: 6,770

Send a message via MSN to Chrispy Send a message via Yahoo to Chrispy
Random quote alignment

Okay, if you go here, you'll see that in the Wise Words pane, there is a quote, which is neatly aligned with the rest of the panes.

Now this quote basically stays the same each time you view the page. I wanted different quotes to show up every time.

So I got this:

Code:
<SCRIPT>
/*
Script obtained from Wsabstract.com
For this script and more
Visit Java-Scripts.net or Wsabstract.com
*/

quote0= "Life is like a box of chocolates.";
quote1= "Java-Scripts.net is like a box of coco pops. ";
quote2= "I have no idea what I am saying. ";

var ran_unrounded=Math.random()*2;
var ran_number=Math.round(ran_unrounded);

document.write(eval("quote"+ran_number));
</SCRIPT>
Here's the code for my Wise Words thingy:

Code:
div class="sidebox">
				<h1>Wise Words</h1>
			
				<p>&quot;All one really needs to achieve something is practice, and the right tools.&quot;</p>		
			
				<p class="align-right">- Me, <a href="http://www.novahq.net/">novahq.net</a></p>
		
			</div>
Now the problem is, is that for the random quote code I got, the text is not aligned properly like how it's shown currently on my page.

I've tried several ways to fix this, but no luck.

If someone could help, that would be totally awesome.

Thanks guys.

Chris
__________________
Intel Core Duo E7300 2.66GHz // SuperTalent DDR2 800 2GB // ASUS nVidia GeForce 8400GS 512MB // Western Digital 7200RPM 320GB SATA // LG GH-20LS 20X SATA DVD-RAM // Windows XP Pro 32-bit // Thermaltake XP550 NP 430W // Thermaltake SOPRANO SECC Black
Reply With Quote
  #2  
Old 09-04-2007, 08:16 AM
IcIshoot is offline IcIshoot

Join Date: Mar 2004
Location: Farmington Hills, MI
Posts: 1,473

Send a message via AIM to IcIshoot Send a message via MSN to IcIshoot Send a message via Yahoo to IcIshoot
if you want every thing centered:

add an align=center to the div opening tag - like so

Code:
div class="sidebox" align="center">
				<h1>Wise Words</h1>
			
				<p>"All one really needs to achieve something is practice, and the right tools."</p>		
			
				<p class="align-right">- Me, <a href="http://www.novahq.net/">novahq.net</a></p>
		
			</div>
for just the quote it self

add align="center" to your opening <p> tag for the quote:

Code:
<p align="center">"All one really needs to achieve something is practice, and the right tools."</p>
Reply With Quote
  #3  
Old 09-04-2007, 11:19 PM
Chrispy is offline Chrispy

Join Date: Sep 2005
Location: Peria, New Zealand
Posts: 6,770

Send a message via MSN to Chrispy Send a message via Yahoo to Chrispy
I tried doing that to this but it disappeared:

Code:
				<SCRIPT>
				/*
				Script obtained from Wsabstract.com
				For this script and more
				Visit Java-Scripts.net or Wsabstract.com
				*/

				<p class="align-right">quote0= "Life is like a box of chocolates.";</p>
				quote1= "Java-Scripts.net is like a box of coco pops. ";
				quote2= "I have no idea what I am saying. ";

				var ran_unrounded=Math.random()*2;
				var ran_number=Math.round(ran_unrounded);

				document.write(eval("quote"+ran_number));
				</SCRIPT>
Doesn't really matter really, but big thanks for the help.

Also, one more question shall do (I really hate asking lots of questions to someone - as long as you're happy answering it, I'm happy too).

I have this search box code here:

Code:
		<div class="searchform">
			<form action="#">
				<p>
				<input name="search_query" class="textbox" type="text" />
  				<input name="search" class="button" value="Search" type="submit" />
				</p>
			</form>			
		</div>
Unfortunately, it doesn't work (or so I think?). I just get redirected to the same existing page when I use it. I'm assuming it's the <form action="#"> (seeing it's a got a hash meaning it's null?). I put in something like index.htm replacing the hash but no luck.

If you could help getting it to work, that would be awesome.

Chris
__________________
Intel Core Duo E7300 2.66GHz // SuperTalent DDR2 800 2GB // ASUS nVidia GeForce 8400GS 512MB // Western Digital 7200RPM 320GB SATA // LG GH-20LS 20X SATA DVD-RAM // Windows XP Pro 32-bit // Thermaltake XP550 NP 430W // Thermaltake SOPRANO SECC Black
Reply With Quote
  #4  
Old 09-04-2007, 11:52 PM
IcIshoot is offline IcIshoot

Join Date: Mar 2004
Location: Farmington Hills, MI
Posts: 1,473

Send a message via AIM to IcIshoot Send a message via MSN to IcIshoot Send a message via Yahoo to IcIshoot
Lol I don't mind answering questions - Though to be honest why wait for a responce when a google search could give you the answer quicker?


For your quotes you want to write out the <p align="center"> code with the qoute

So either something like

quote0="<p align='center'>My qoute</p>";

document.write(quote0);

(notice that I used in the align code in text for the variable)

Or

document.write('<p align="center">' + quote0 + '</p>');



For the search engine you need something in the action attribute so it knows what to do with it.

for example: a simple form to display a name using php:

html page form
Code:
<form action="submit.php" method="get">
<input name="p_name" type="text" />
<input type=submit />
</form>
submit.php code:

Code:
<?php
$p_name=$_GET["p_name"];

echo "Hello $p_name";
?>
I don't know if javascript can do a search - would need more info on exactly what your trying to do...


I have only ever used php for form actions - you may want to read up on html forms.

I know javascript can read the arguments passed to the page via the query string.


IcI
Reply With Quote
  #5  
Old 09-05-2007, 12:19 AM
Chrispy is offline Chrispy

Join Date: Sep 2005
Location: Peria, New Zealand
Posts: 6,770

Send a message via MSN to Chrispy Send a message via Yahoo to Chrispy
K thanks man.

Google? Sometimes I use it, sometimes I don't. I don't always get the exact answer I need sometimes anyway with Google.

Chris
__________________
Intel Core Duo E7300 2.66GHz // SuperTalent DDR2 800 2GB // ASUS nVidia GeForce 8400GS 512MB // Western Digital 7200RPM 320GB SATA // LG GH-20LS 20X SATA DVD-RAM // Windows XP Pro 32-bit // Thermaltake XP550 NP 430W // Thermaltake SOPRANO SECC Black
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mature: adendume,another new quote bigsmellyfart Humor & Jokes 0 06-26-2011 12:35 AM
template alignment -Tigger- Web design and Programming 0 01-01-2006 11:01 AM
Quote Sig Chels Sigs and Graphics 10 05-06-2005 10:20 AM
Quote: RoDent Humor & Jokes 0 03-09-2003 10:37 PM
quote:I think this would be the end of BHD (Old) General Chat 12 11-22-2002 08:46 PM


All times are GMT -5. The time now is 09:21 AM.




Powered by vBulletin®