Is there an easy way to loop through all td tags and change them to th? (etc).
My current approach would be to wrap them with the th and then remove the td, but then I lose other properties etc.
Hi,
I have the following code to display
<display:table name="sessionScope.userList" id="userList" export="false" pagesize="1">
<display:column title="Select" style="width: 90px;">
<input type="checkbox" name="optionSelected" value=""/>
</display:column>
<display:column property="userName" sortable="false" title="UserName" paramId="userName" style="width: 150px; text-align:center" href="#"/>
</display:table>
On click of the checkbox i need to get the corresponding row value that is the username how would i get that?
Here's a snippet of my mvc-config.xml
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".jsp"/>
</bean>
<mvc:view-controller path="/index" view-name="welcome"/>
<mvc:view-controller path="/static/login" view-name="/static/login"/>
<mvc:view-controller path="/login" view-name="/static/login"/>
I have the welcome.jsp on /WEB-INF/view/ directory and login.jsp on /WEB-INF/view/static/.
This work for '/index' and '/login' paths. But I'm getting 404 response for '/static/login' when invoked from the browser. I'm expecting that '/static/login/' and '/login' should behave the same.
What could be wrong here?
Would appreciate any help.
Thanks!
I've encountered a problem with generating reverse url in templates in django. I'm trying to solve it since a few hours and I have no idea what the problem might be. URL reversing works great in models and views:
# like this in models.py
@models.permalink
def get_absolute_url(self):
return ('entry', (), {
'entry_id': self.entry.id,
})
# or this in views.py
return HttpResponseRedirect(reverse('entry',args=(entry_id,)))
but when I'm trying to make it in template I get such an error:
NoReverseMatch at /entry/1/
Reverse for ''add_comment'' with arguments '(1L,)' and keyword arguments '{}' not found.
My file structure looks like this:
project/
+-- frontend
¦ +-- models.py
¦ +-- urls.py
¦ +-- views.py
+-- settings.py
+-- templates
¦ +-- add_comment.html
¦ +-- entry.html
+-- utils
¦ +-- with_template.py
+-- wsgi.py
My urls.py:
from project.frontend.views import *
from django.conf.urls import patterns, include, url
urlpatterns = patterns('project.frontend.views',
url(r'^entry/(?P<entry_id>\d+)/', 'entry', name="entry"),
(r'^entry_list/', 'entry_list'),
Then entry_list.html:
{% extends "base.html" %}
{% block content %}
{% for entry in entries %}
{% url 'entry' entry.id %}
{% endfor %}
{% endblock %}
In views.py I have:
@with_template
def entry(request, entry_id):
entry = Entry.objects.get(id=entry_id)
entry.comments = entry.get_comments()
return locals()
where with_template is following decorator(but I don't think this is a case):
class TheWrapper(object):
def __init__(self, default_template_name):
self.default_template_name = default_template_name
def __call__(self, func):
def decorated_func(request, *args, **kwargs):
extra_context = kwargs.pop('extra_context', {})
dictionary = {}
ret = func(request, *args, **kwargs)
if isinstance(ret, HttpResponse):
return ret
dictionary.update(ret)
dictionary.update(extra_context)
return render_to_response(dictionary.get('template_name',
self.default_template_name),
context_instance=RequestContext(request),
dictionary=dictionary)
update_wrapper(decorated_func, func)
return decorated_func
if not callable(arg):
return TheWrapper(arg)
else:
default_template_name = ''.join([ arg.__name__, '.html'])
return TheWrapper(default_template_name)(arg)
Do you have any idea, what may cause the problem?
Great thanks in advance!
I have a select list:
<select id="sel">
<option>text1</option>
<option>text2</option>
<option>text3</option>
<option>text4</option>
</select>
I want to delete all items, without for loop.
I tried:
document.getElementById('sel').length = 0;
But this doesn't work in some browsers.
Any ideas?
Thanks
Hi all,
I have this code:
I need to replace 800px and 300px from database value;
I tried both of the below. But still i am not getting the answer.
Method 1:
<div id="container" style="width:'<% Response.Write(width);%>'px; height:'<% Response.Write(height);%>'px; margin: 0 auto;overflow:hidden;"></div>
Method 2:
<div id="container" style="width:'<%# Eval("width");%>'px; height: <%# Eval("height");%>'px; margin: 0 auto;overflow:hidden;"></div>
The value of height and width variables are defined in page_load() function
int height=300;
int width= 800;
This is not affecting the resulting web page.
Can anyone help me on this.
I am looking for a way to insert javascript code block to end of ASP.NET page.
Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "showVideo", sScript, true);
is appending to body but js codes are always requesting some js files didn't load or some functions are below of the script.
How can i append scripts that i generated dynamically to the bottom of body?
Thanks for your help.
Hi folks,
When sites give you some JavaScript that you paste into a web page to have content inserted at that position, how does the script determine its current position in the DOM? Without using document.write?
Thanks,
Nick
Hi guys,
Quick newbie question here, how do I access totalResults?
XML
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription>
<opensearch:totalResults>1</opensearch:totalResults>
<posts>
<post>
<score>10</score>
</post>
</posts>
</OpenSearchDescription>
To access the score I would do this:
PHP
$xmlObj = simplexml_load_string($theXMLabove);
echo $xmlObj->posts->post[0]->score;
But none of these work for the totalResults:
echo $xmlObj->opensearch:totalResults;
echo $xmlObj->opensearch->totalResults;
Sorry for asking such a lame question...
Documentation on how to traverse XML with PHP is also appreciated :)
Thanks!
I need to highlight an email addresses in text but not highlight them if contained in HTML tags, content, or attributes.
For example, the string [email protected] must be converted to <a href="mailto:[email protected]">[email protected]</a>
But email addresses in the string <a href="mailto:[email protected]">[email protected]</a> must not be processed.
I've tried something like this regexp:
(?<![":])[a-zA-Z0-9._%-+]+@[a-zA-Z0-9._%-]+.[a-zA-Z]{2,6}(?!")
but it doesn't work properly.
I am generating a table dynamically using Django.
The same table template is used to generate a variety of tables depending on the data supplied. In one scenario a particular column contains image tags.
Since my table is editable (using jquery) the image cell also becomes editable and removes my content.
I want some special behavior on double click of such cells like say upload an image. How do I accomplish this with a jquery?
My script for making the table editable is given below.
$(function() {
$("td").dblclick(function() {
var OriginalContent = $(this).text();
$(this).addClass("cellEditing");
$(this).html("<input type='text' value='" + OriginalContent + "' />");
$(this).children().first().focus();
$(this).children().first().keypress(function(e) {
if (e.which == 13) {
var newContent = $(this).val();
$(this).parent().text(newContent);
$(this).parent().removeClass("cellEditing");
}
});
$(this).children().first().blur(function() {
$(this).parent().text(OriginalContent);
$(this).parent().removeClass("cellEditing");
});
});
});
what would be the impact on SEO of changing the text of the <h1> dynamically on the server side each time the web page loads?
I'm not talking about changing the whole text, just part of it, for example if the header contains some fixed text (with keywords of course), and also contains the current date or time/the current number of logged on users/the count of items current in stock/whatever.
how would that affect my ranking? is it bad? doesn't make a difference?
thanks.
I want to create an img that has four different states:
State 1 over
State 1 out
State 2 over
State 2 out
Each state is a different image, and the user can toggle between states 1 and 2 by clicking on the image.
To do this I change the src when the image is clicked and the onmouseover and onmouseout attributes of the img element. However when the attributes have been changed they become nulled and do nothing. How can I dynamically change these properties?
Here is the code I am using:
<!DOCTYPE html>
<html>
<head>
<script>
function change()
{
document.getElementById('image').src="http://youtube.thegoblin.net/layoutFix/hideplaylist.png";
document.getElementById('image').onmouseover="this.src='http://youtube.thegoblin.net/layoutFix/hideplaylistDark.png'";
document.getElementById('image').onmouseout="this.src='http://youtube.thegoblin.net/layoutFix/hideplaylist.png'";
}
</script>
</head>
<body>
<img id="image" src="http://youtube.thegoblin.net/layoutFix/showplaylist.png" onmouseover="this.src='http://youtube.thegoblin.net/layoutFix/showplaylistDark.png'" onmouseout="this.src='http://youtube.thegoblin.net/layoutFix/showplaylist.png'" onClick="change()">
</body>
</html>
i have this html code:
<p style="padding:0px;">
<strong style="padding:0;margin:0;">hello</strong>
</p>
but it should become (for all possible html tags):
<p>
<strong>hello</strong>
</p>
this is driving me crazy, is there a regexp expert that can give me a hand? thanks!
IM using three different user control.. i want make those controls and child controls as control collection . so that its reusable.How can i achieve this. Thanks in advance.
I'm having a little problem with jade. Here is the following code :
each user in users
- if (user.valid == 1)
tr(style="color:green;")
- else
tr(style="color:red;")
td
= user.mail
td
= user.lastIp
td
= user.token
td
= user.valid
My problem is that the tds are created only in the else case. if the if (user.valid == 1) is true, then it creates an empty tr.
Is there a way I can create my tr with this condition, and then only fill them ?
Thanks :)
Hi all,
I have a link:
<a id="nextBut" href="somelink" class="button"><span>Next Step</span></a>
And I can control the the <span>Next step</span> part with innerHTML but how could I leave the <span> alone and just change the 'Next step' part?
For example:
var NextButJar = document.getElementById('nextBut');
NextButJar.disabled = true;
NextButJar.style.opacity = .5;
NextButJar.span.innerHTML = 'Read all tabs to continue';
I also have:
NextButJar.onClick = handleClick;
function handleClick(){
if (this.disabled == true) {
alert("Please view all tabs first!");
return;
} else {
alert("allowed to run");
}
};
Which I can't seem to get working either...
I'm fairly new to Ruby on Rails, and I'm attempting to create some fancy CSS buttons using the "sliding doors" technique. I have it almost working, but I feel like there has to be a better way to handle the tags for a link.
The way I'm currently doing it:
<%= link_to '<span>New car</span>', {:action => "new"}, :class=>"button" %>
This isn't terrible, per se, but I would like to know if this is the best way to handle span tags is RoR.
I have an object tag in a HTML file:
<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95">
<param name="FileName" value="../ABC/WildLife.wmv" id="mediaPlayerFile">
<param name="AutoStart" value="false" />
</object>
I want to change the filename using javascript.
What I have so far is this:
<script type="text/javascript">
function disp_current_directory() {
var val = document.getElementById('mediaPlayerFile');
val.attributes['value'].value = "D:\XYZ\WildLife.wmv";
}
</script>
But this doesn't work. :(
Is it possible? If yes, how?
I am working on and Microsoft MVC3 project and cannot pass a parameter which has been edited to the controller. It will only pass back the original set parameter
For example:
@Ajax.ActionLink("share file", InviteController.Actions.Result, InviteController.Name, new { message = Model.Message }, new AjaxOptions
{
HttpMethod = "GET",
UpdateTargetId = "popup",
OnSuccess = "$('#popup').dialog('open')"
}, new { id = "popup-button" })
<label>Personal Message <span class="optional-message">(optional)</span></label>
@Html.TextAreaFor(x => x.Message)
</div>
This will pass the to the following controller but the 'message' parameter has the original message and not the updated message:
public ActionResult Result(FormCollection coll, string message)
{
I'd love if someone could give me some advice.
Many Thanks
I have the following scenario.
I show the user some audio files from the server. The user clicks on one, then onFileSelected is eventually executed with both the selected folder and file. What the function does is change the source from the embedded object. So in a way, it is a preview of the selected file before accepting it and save the user's choice. A visual aid.
HTML
<embed src="/resources/audio/_webbook_0001/embed_test.mp3" type="audio/mpeg" id="audio_file">
JavaScript
function onFileSelected(file, directory) {
jQuery('embed#audio_file').attr('src', '/resources/audio/'+directory+'/'+file);
};
Now, this works fine in Firefox, but Safari and Chrome simply refuse to change the source, regardless of Operating System.
jQuery finds the object (jQuery.size() returns 1), it executes the code, but no change in the HTML Code.
Why does Safari prevent me from changing the <embed> source and how can I circumvent this?
I want to create a drop down menu having options and then on selecting option i will hit the submit button that will redirect me to the particular. I have code something like this
<%= select_tag "options", options_for_select([["Dashboard", "/homes/"+user.saving_account.id.to_s], ["Edit", "/user/"+registrar]] ) %>
Now I want when I choose any of these option and hit button that will redirect either of these.
Any ideas????
I am Newbie to NFC Android App Development. I am done with the App development and everything worked fine. As part of my testing I used MifareClassic as well MifareDesfire tags to write and read. I am storing data in Ndef format. Initially I used the above testing tags with other apps like Nxp tagwriter and Tagstand Tagwriter and then I used with My app. So everything worked fine. Even later I used my app to write and read data from Sony Felica tags(new tags) which also worked fine. So I passed app to client for review but I came to know that app is not writing on New Tags. If they are reset from other apps then It works fine. So I done the same test here and found the same issue as client reported. What might be the issue? Has someone come across same kind of issue? Is it required to format before using? if so how to do that? Someone Help to solve the issue.
Thanks in Advance.