Show link in html table cell - html

I'm tring to add a link in my code like below,I have written a javascript function,thing is in UI it has to show data as link.
string str="" + dataTable.Rows[i][j] + ""
Is there a way to show my datatable data as a link in UI?
Reply

assuming that your dataTable[i][j] is the link .. we can simply do this in javascript to create a link
link = '<a href="' + dataTable[i][j] + '" >Link</a>';
then use this string wherever you want.
or as i just saw the updated question
'<td>' + dataTable[i][j] + '</td>'

Where is the start of the anchor (<a ...>) tag? There is only an end one. Try...
<td>{link}</td>

Related

Putting HtmlWidget elements in a paragraph

May I know how to put the elements I get from HtmlWidget(allwordlist![0].ivakavakayagataki.toString()), HtmlWidget(allwordlist![0].ivakavakayagataki.toString()), in a paragraph?
I am making a dictionary application and the above HTML render code works but problem is that I cannot seem to find a way to put these two in a paragraph as in side by side like a sentence.
May I get some help un knowing how to do this please.
Thanks in advance.
Ok so I made it work.
So I first made this function and not that <p> tags so the problem thats was making my HtmlWidget statement not inline and having line breaks was because of the p tag so I first took it out.
Widget mergehtml(String html1, String html2,){
html1 = html1.replaceAll("<p>", "").replaceAll("</p>", "");
html2 = html2.replaceAll("<p>", "").replaceAll("</p>", "");
String mergedHtml = "<p style='font-size:18px;'>" + html1 + " " + "[" + html2 + "], " + "</p>" ;
return HtmlWidget(mergedHtml);
}
and then I called it and put my two variables there.
mergehtml("${allwordlist![0].tina}","${allwordlist![0].itavi}",)
it then started working inline.
Thanks :)

This is part of a code to auto-fill a web-page in google chrome (using console), What programming language is it?

I'm trying to understand this code to auto-fill a webpage, what is the language?
$('body').append('<script>' +
'function autoFill() {' +
' $("input[data-colorid=\'81\']").prop("checked", true);' +
' $("input[data-colorid=\'81\']").trigger("click");' +
' $("input[name=\'GoldenCard\']").filter(\':first\').prop("checked", true);' +
' $("input[name=\'GoldenCard\']").filter(\':first\').trigger("click");' +
' $("#featuresNextStep").trigger("click");' +
' $("input[name=firstName]").val("some name").trigger("change");' +
' $("#directiveProvince").val("5").trigger("change");' +
' $("#directiveCity").val("227").trigger("change");' +
' $("#LoginButton").trigger("click");'
It's jQuery.
$ is an alias for jQuery, and after $ follows the element selecting query.
Example:
$("#LoginButton") is the same like getElementById("LoginButton").
Example 2:
$("#LoginButton").trigger("click"); triggers a click event on the login button element in the DOM.

multi-line in aurelia component html attribute property

This is a weird question about possibly embedding a string in an aurelia html file within the attribute tag but I would like to keep my tab and line formatting.
So, in my TS file I have the following:
this.queryDateStart += "type=EntityOne&dateQueryString=";
this.queryDateStart += "" +
"eOr( " +
"eAnd( " +
"eAnd( facetName:isExcluded AND facetValue:No );" +
"dAnd( facetName:deadlineDate AND "+ dateRangePredicate + ");" +
"); " +
"dOr( " +
"(facetName:excludedUntilDate AND "+ dateRangePredicate + ")" +
");" +
");"
And instead of having the following:
<section as-element="ab-deadlines" data-query="${queryDateStart}"></section>
I would like to actually pass the literal string from above.
But with the line spaces.
Would that break anything?
So for example ( going to try this today) - in my html file I would put:
<section as-element="ab-deadlines"
data-query="
eOr(
eAnd(
eAnd( facetName:isExcluded AND facetValue:No );
dAnd( facetName:deadlineDate AND ${dateRangePredicate} );
);
dOr(
(facetName:excludedUntilDate AND + ${dateRangePredicate} )
);
);"></section>
About breaking: it shouldn't break anything. In the end, it's just normal HTML attribute, and as long as the spec allows it, it works in Aurelia, as Aurelia works directly, and plainly with HTML elements.
You can see it yourself at this sandbox https://codesandbox.io/s/z20qx0q263

GWT html object show text as url or img

I get a URL as text from database and put it into an HTML object and add this object to layout.
I want this text to work as URL or IMG.
you can see in the code what I have tried. didn't find a method that does that...
my code :
int listSize = result.size();
int i;
assetPanel.clear();
for(i=0;i<listSize;i++)
{
HorizontalPanel vPanelPic = new HorizontalPanel();
HTML picSpace = new HTML();
picSpace.setHTML("<img src = " + result.get(i).getUrl() + "style=width:304px;height:228px>");
//Window.alert("<a href " + result.get(i).getUrl()+ "</a>");
vPanelPic.add(picSpace);
assetPanel.add(vPanelPic);
}
Your HTML is invalid. Try this:
// img:
picSpace.setHTML("<img src='" + result.get(i).getUrl() + "' style='width:304px;height:228px'>");
// link:
Window.alert("<a href='" + result.get(i).getUrl() + "'>URL</a>");
I think that post solves the problem without any security issues :
For SafeHtml, Do we need to sanitize the "link" in <img src=link> tag, GWT?

how to fill with page with json.data with better looking code?

until now, this is kind of how i fill my page with data i received from $.getJSON.
collection.push("div class='item'><img src='" + items[i].imgurl + "' /><h1>" + items[i].itemname + "</h1><p id='desription" + i + "'>" + items[i].infotxt + "</p></div>);
those lines look so terrible inside my editor, that i wonder if this is even the right way to do it...
might there something like a class costructor for this or anything like that?
thank you very much
Have you looked into the jquery-json plugin?
https://code.google.com/p/jquery-json/