Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 11-09-2004, 08:17 AM   #1 (permalink)
buchannon
Registered User
 
buchannon's Avatar
 
Join Date: Nov 2004
Posts: 43
buchannon is on a distinguished road
layout menu form

Is there a simple way to change the default option selected in a layout menu? Here is the menu, and I have a variable caled "size" that the user can change, was just wondering if I could make "size" the default.

Quote:
<form mehtod="get" action="test.asp">
<select title="Select a Font Size" name="fontsize" id="FontSize" style="width:75px" class="layoutMenu">
<option value="10px">10px</option>
<option value="11px">11px</option>
<option value="12px" selected>12px</option>
<option value="13px">13px</option>
<option value="14px">14px</option>
<option value="15px">15px</option>
<option value="16px">16px</option>
<option value="17px">17px</option>
<option value="18px">18px</option>
<option value="19px">19px</option>
<option value="xx-large">extra Large</option>-->
</select>
<input type="submit" value="GO TO IT!">
</form>
buchannon is offline   Reply With Quote
Old 11-09-2004, 08:53 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,470
sde is on a distinguished road
here is a way ...
HTML Code:
<select title="Select a Font Size" name="fontsize" id="FontSize" style="width:75px" class="layoutMenu">
<script language="JavaScript">
<!--
for(i=10;i<20;i++){

  document.write('<option value="'+i+'px"'); 
  if(size==i+'px'){document.write(' selected');}  
  document.write('>'+i+'px</option>\n');

}
document.write('<option value="xx-large"');
if(size=='xx-large'){document.write(' selected');}
document.write('>xx-large</option>\n');

-->
</script>
</select>
i see you're using asp, why not just do this server-side?
__________________
Mike
sde is online now   Reply With Quote
Old 11-09-2004, 11:02 AM   #3 (permalink)
buchannon
Registered User
 
buchannon's Avatar
 
Join Date: Nov 2004
Posts: 43
buchannon is on a distinguished road
I thought ASP was server side...
buchannon is offline   Reply With Quote
Old 11-09-2004, 11:28 AM   #4 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,470
sde is on a distinguished road
asp is server-side, but i thought you were asking for help doing this with javascript since you posted this in the html/javascript forum.
__________________
Mike
sde is online now   Reply With Quote
Old 11-09-2004, 11:32 AM   #5 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,470
sde is on a distinguished road
ok, let me clarify.. anything that is javascript, i.e. you are using <script language=javascript>, executes on the client side.

even though you are coding on an asp page, it's not getting processed server-side unless you are inside the <% %> tags. if you are between those tags, you can use vbscript ( i think javascript too ) to process thing before the page is served to the client.

if you wanted to know how to do this in asp (vb) , then you should probably post it in the MS technologies forum, .. but i tested my example and it will work for a javascript solution.

the thing is that your javascript variables are completely different than your asp variables since they execute 2 seperate ways ( client / server )

i'm not sure your level of understanding, so i appologize if i am explaining some things you already know.
__________________
Mike
sde is online now   Reply With Quote
Old 11-09-2004, 11:41 AM   #6 (permalink)
buchannon
Registered User
 
buchannon's Avatar
 
Join Date: Nov 2004
Posts: 43
buchannon is on a distinguished road
Don't worry about offending me, I am just happy for your help. I understand JS being client side, and the ASP being Server Side.

I got it figured out using VB ASP. At least I got it figured out thus far... I'm sure I'll have another problem in about 10 min. Thanks for the help sde!
buchannon is offline   Reply With Quote
Old 11-09-2004, 12:05 PM   #7 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,470
sde is on a distinguished road
i find it funny that your job is worried about 'vulnerabilities' with php, and they run a windows web server
__________________
Mike
sde is online now   Reply With Quote
Old 11-09-2004, 12:08 PM   #8 (permalink)
buchannon
Registered User
 
buchannon's Avatar
 
Join Date: Nov 2004
Posts: 43
buchannon is on a distinguished road
hehe... I have no idea. Maybe they are just too lazy to install PHP. I can't imagine it being that hard to do but who knows...

The positive part of this is that I'm learning some basic ASP which is (to my understanding) a lot more powerful than JS anyway. So I'm not really loosing out on much ? Or is PHP > ASP?
buchannon is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
EMERGENCY: Dynamic form processing DavH27 PHP 8 10-27-2004 07:52 PM
javascript riddle: why won't my form submit from this text link? sde HTML, XML, Javascript, AJAX 6 09-29-2004 05:56 AM
populate form field virtualGeorge PHP 4 08-23-2004 08:05 AM
HTML form preview then INSERT using PHP & MySQL SteveSoler PHP 5 07-07-2002 09:54 AM
Passing form data to PHP with Javascript bdl PHP 5 07-03-2002 10:18 AM


All times are GMT -8. The time now is 10:55 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting