tgreer 189 Made Her Cry Team Colleague

We're venturing off into another discussion. I don't know the particulars of the OP's environment or application, but in general, I say "hands off" on anything that is in the User Model. This includes such often-requested items as auto-sizing a window, auto-printing a page, disabling certain script warnings, obscuring or making "View Source" difficult, and replacing or editing the context menu.

This link should be of interest to you in regard to adding to context menu(s):

http://msdn.microsoft.com/workshop/browser/ext/tutorials/context.asp

tgreer 189 Made Her Cry Team Colleague

Wait... I know IE provides an "oncontextmenu" event handler. I'm not sure about FireFox.

You could code that in the body, as so:

<body oncontextmenu="return false;">

However, this is where I make my standard plea/warning: users expect that when they right-click, they get a context menu. I, for example, routinely use it to access "back". It's faster than mousing up to the top of the browser. Disabling or co-opting features that users have come to expect violates a basic application design principle, and should be avoided, in my opinion.

So unless you have a very compelling reason for doing this, I would suggest that you leave it alone.

tgreer 189 Made Her Cry Team Colleague

I think you'll have to code to the Event object, which has cross-browser issues. But the Event object is created when any event occurs, and you might be able to tell if a click was a left or a right click and code accordingly. So my first thought would be to research the JavaScript "Event" object.

tgreer 189 Made Her Cry Team Colleague

I believe there are classes built into the .NET Compact Framework for Short Message Service.

tgreer 189 Made Her Cry Team Colleague

Page refreshing would be a client-side issue. You'd use JavaScript for that.

tgreer 189 Made Her Cry Team Colleague

The best way is to author a JavaScript that does so. You don't want a complete server roundtrip just to open a window!

You can add scripts via "RegisterStartupScript" method of the Page object.

tgreer 189 Made Her Cry Team Colleague

Sorry, but this doesn't make sense to me. Can you post a better pseudo-code example? If you have something that needs to execute before something else happens, code the first "thing" as a method that returns a value. Test the value, then move forward or not.

There should never be a need to do what you're asking to do.

tgreer 189 Made Her Cry Team Colleague

...but it did work for me, IE and FireFox.

tgreer 189 Made Her Cry Team Colleague

You cannot do this with HTML alone. Or even, for that matter, JavaScript, which is a language to manipulate things (the web document, the browser, cookies) on the client. You'll need to learn at least a server-side language (may I suggest "PHP"), and likely a database and SQL.

tgreer 189 Made Her Cry Team Colleague

It's very simple. If you have a single form on the page, then this hyperlink would submit it:

<a href="#" onclick="document.forms[0].submit();">Submit form</a>

There are a couple of variations. I prefer to refer to all HTML elements via their ID property. So if you give your form an ID, like:

<form id="myForm" method="post" action="myFormProcessor.php">

then your hyperlink could be:

<a href="#" onclick="document.getElementById('myForm').submit();">Submit form</a>

Lastly, if you don't like having that href, you can also code it:

<a href="javascript:document.forms[0].submit();">Submit form</a>
tgreer 189 Made Her Cry Team Colleague

So, in fact you DO want to POST a FORM, you just don't want an "ugly button". Right? Then either style the button using CSS, or code almost any other HTML element, such as a hyperlink, to fire the form's "submit()" method.

(You might have had more answers, sooner, if you'd posted in the HTML/JavaScript forum rather than PHP.)

tgreer 189 Made Her Cry Team Colleague

This is a HUGE topic. I work in printing/publishing, and code PostScript, so I've written my share of text justificaiton routines.

Simple approach: adjust the whitespace between words

Better approach: adjust the majority of the whitespace between words, the rest between individual spaces. I use 80/20, it seems to be the most balanced.

Sophisticated approach: add hyphenation. <-- may take years to get right!

tgreer 189 Made Her Cry Team Colleague
tgreer 189 Made Her Cry Team Colleague

I get no such message. You're probably testing/loading your pages LOCALLY. IE will indeed block scripts in pages that you load from your local file system. You can't, as far as I know, turn it off.

But never fear, people who browse to your page don't get the warning.

tgreer 189 Made Her Cry Team Colleague

browserCaps will also fix some of the HTML rendering issues. Panels will render as DIVs instead of Tables, etc. I've been meaning to write an article on browerCaps...

tgreer 189 Made Her Cry Team Colleague

I would start on MSDN. Their articles on .NET programming generally include sample code.

tgreer 189 Made Her Cry Team Colleague

Please post your question in a new thread.

tgreer 189 Made Her Cry Team Colleague

Make sure you use "Form1" instead of "myForm", for one thing. I don't see why you need two buttons. Or, why you need to set a Session variable. But that's all beside the point: it's saying it doesn't recognize "document.getElementById()"??

That is truly strange.

Take the "onlick=printMe();" out of your element declaration.

tgreer 189 Made Her Cry Team Colleague

Your error is because, in ASP.NET-world, the "onclick" attribute points to SERVER code. So the compiler is looking for a "printMe()" method in your code-behind page. In a way, then, yes - it's because you're using a web control.

That's why I wrote previously:

ASP.NET is NOT traditional web development, however. For one, your "onclick" code for the button control refers to server code. That would be your audit code that checked for "printed=YES".

To get a client-side click event registered to a server control, you have to do:

Code:

myServerControl.Attributes.Add("onclick","printMe();");

Now, to get the hidden form element's value, you can either 1) turn it into a server object by adding the runat=server attribute to the element's declaration, or 2) use the ASP.NET Request object.

tgreer 189 Made Her Cry Team Colleague

First, your print button can be an ASP.NET Web Server control, or not. Thinking it over, it might be good to use one, since then you can run both client and server-side code for it.

Let's talk about client-side first. You need to accomplish two things:

1) Open a print dialog box when the button is clicked.
2) Pass a value back to the server code that indicates the user clicked that button.

You accomplish the first task using the JavaScript window.print() method. You accompish the second task by setting the value of a hidden form element. You can do both tasks in a single JavaScript function. Here's a first attempt at what the code might look like:

<html>
<head>
<title>JavaScript Sample by tgreer</title>
<script type="text/javascript">
  function printMe()
  {
     window.print();
     document.getElementById("printed").value = "YES";
     document.getElementById("myForm").submit();
  }
</script>
</head>
<body>
  <form id="myForm">
    <input type="button" value="Print me" onclick="printMe();" />
    <input type="hidden" id="printed" />
  </form>
</body>
</html>

Now, in any traditional web development system, that would be pretty much it. The user would click the button, which would fire the script. The script opens the print dialog box, sets a hidden form element value, and submits the form.

The server code would parse the Request object to see if "printed=YES", and if so, do whatever it is you want to do.

ASP.NET is NOT traditional web development, however. For one, your "onclick" code for the button control refers to server code. That would be your audit code …

tgreer 189 Made Her Cry Team Colleague

Did that answer your question? Any feedback?

tgreer 189 Made Her Cry Team Colleague

Ok, this is very rudimentary, but consider this page:

<html>
<head>
<script type="text/javascript">
function parseState()
{
  var q = unescape(location.search);
  q = q.substring(7, q.length);
  if (q != "")
  {
    document.getElementById("state").options.selectedIndex = q;
  }
}
</script>
</head>
<body onload="parseState();">
<form>
<select id="state">
<option value="" selected="selected">Select a State</option>
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="DC">District Of Columbia</option>
<option value="FL">Florida</option>
<option value="GA">Georgia</option>
<option value="HI">Hawaii</option>
<option value="ID">Idaho</option>
<option value="IL">Illinois</option>
<option value="IN">Indiana</option>
<option value="IA">Iowa</option>
<option value="KS">Kansas</option>
<option value="KY">Kentucky</option>
<option value="LA">Louisiana</option>
<option value="ME">Maine</option>
<option value="MD">Maryland</option>
<option value="MA">Massachusetts</option>
<option value="MI">Michigan</option>
<option value="MN">Minnesota</option>
<option value="MS">Mississippi</option>
<option value="MO">Missouri</option>
<option value="MT">Montana</option>
<option value="NE">Nebraska</option>
<option value="NV">Nevada</option>
<option value="NH">New Hampshire</option>
<option value="NJ">New Jersey</option>
<option value="NM">New Mexico</option>
<option value="NY">New York</option>
<option value="NC">North Carolina</option>
<option value="ND">North Dakota</option>
<option value="OH">Ohio</option>
<option value="OK">Oklahoma</option>
<option value="OR">Oregon</option>
<option value="PA">Pennsylvania</option>
<option value="RI">Rhode Island</option>
<option value="SC">South Carolina</option>
<option value="SD">South Dakota</option>
<option value="TN">Tennessee</option>
<option value="TX">Texas</option>
<option value="UT">Utah</option>
<option value="VT">Vermont</option>
<option value="VA">Virginia</option>
<option value="WA">Washington</option>
<option value="WV">West Virginia</option>
<option value="WI">Wisconsin</option>
<option value="WY">Wyoming</option>
</select>
</form>
</body>
</html>

If this page was named "pickstate.html", and you loaded it with the querystring:

pickstate.html?state=1

Then, "Alaska" would be selected in the SELECT element.

Why do I say it's rudimentary? For one, the querystring parser isn't robust. Ideally, you'd parse the entire querystring into a JavaScript array, so you could pass in multiple values. Not important in your scenario. Also, it relies on "?state=" having seven characters, intead of finding the value by searching for the equal sign.

Next, the index has …

tgreer 189 Made Her Cry Team Colleague

I would append a querystring, containing the value of the previously selected state. Then, author an onload script that checked for the querystring value, and make that the selected option in the select list. If there is no querystring (ie/ first time the page loads), then select some default state.

tgreer 189 Made Her Cry Team Colleague

You're welcome!

tgreer 189 Made Her Cry Team Colleague

"Top" is the top-level window object in the hierarchy. Think of it as your "frameset" page.

So "top" contains all of your frames. You're saying, "go to the top window object, look into all the frames it contains, find the one named 'mainFrame', and set that frame's location to the URL 'www.tgreer.com'.

tgreer 189 Made Her Cry Team Colleague

Modify your window.location statement in your track() procedure to reference a specific frame, rather than the entire "window":

top.frames["mainFrame"].location.href="www.tgreer.com";
tgreer 189 Made Her Cry Team Colleague

Thanks. We'll need to see your stripped-down frameset code, so we can see how many frames you have, their relationship to each other, the IDs you've given them, and so on.

tgreer 189 Made Her Cry Team Colleague

I'm not sure where the concept of "bottom" fits within the frame hierarchy. But you can refer to specific frames using an indexer of the frame collection:

frames[1], frames[2], and so on.

Also look at the "top" and "parent" objects, and possible the "this" keyword, the "self" object, and so on. Seeing some code would help us help you.

tgreer 189 Made Her Cry Team Colleague

That's only the case with locally loaded HTML files. Once you publish to a website, your users will not get that message.

tgreer 189 Made Her Cry Team Colleague

Yes, you're correct. It is much slower in FireFox. I'm running Windows XP, SP2, English.

If you can strip down a sample page that includes ONLY your news scroller, and post it here, I will do what I can to help.

tgreer 189 Made Her Cry Team Colleague

This probably isn't a JavaScript problem. It could be a problem on your machine. Does anyone else experience the problem on your site?

tgreer 189 Made Her Cry Team Colleague

I think you'll need some server side code. Something that looks at a timestamp, a rolling counter, a database value, something... and automatically authors the appropriate image tag. Right now, I can't think of how you'd accomplish this with client scripting.